/*
 * TarifaViewer.java
 *
 * Created on 11 de junio de 2007, 03:34 PM
 */

package inc.jmc.cyberboard.ui.ventas;

import inc.jmc.cyberboard.Tarifa;
import inc.jmc.cyberboard.common.ImageLoader;
import inc.jmc.cyberboard.ui.PrecioHoraSegmentPane;
import org.apache.log4j.Logger;

/**
 *
 * @author  JOlguin01
 */
public class TarifaViewer extends javax.swing.JInternalFrame {
    static Logger logger = Logger.getLogger(TarifaViewer.class.getName());
    /** Creates new form TarifaViewer */
    PrecioHoraSegmentPane horaPane;
    public TarifaViewer() {
        initComponents();
        this.setClosable(true);
        this.setMaximizable(false);
        this.setSize(600,280);
        this.setVisible(true);
        this.setResizable(true);
        this.setFrameIcon(ImageLoader.images[ImageLoader.ICON_FRAME_MAIN]);
        jScrollPane1.getVerticalScrollBar().setUnitIncrement(10);


        
        
    }
    
    public void fillDateFromTarifa(String titulo, Tarifa tarifa)
    {
    	horaPane=new PrecioHoraSegmentPane(titulo, tarifa);
        
    	
        //getContentPane().removeAll();
        //getContentPane().add(horaPane, java.awt.BorderLayout.CENTER);
    	jPanel1.add(horaPane);
    	
        this.updateUI();
    }
    public void removeAllTarifas()
    {
    	jPanel1.removeAll();
    	
        this.updateUI();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();

        setTitle("Tarifa Actual");
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                formComponentResized(evt);
            }
        });

        jPanel1.setLayout(new java.awt.GridLayout(0, 1));

        jScrollPane1.setViewportView(jPanel1);

        getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized

        logger.info("tarifaviewer->"+this.getWidth()+","+this.getHeight());
    }//GEN-LAST:event_formComponentResized
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
    
}
